/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Menuavaliacao2.java
 *
 * Created on 5/Dez/2011, 22:52:53
 */
package desint;

import java.awt.CardLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import popup.AvaliacaoEdit;

/**
 *
 * @author lenny
 */
public class Menuavaliacao2 extends javax.swing.JPanel {

    public JanelaPrincipal jp;
    private CardLayout cardlayout;
     
    /** Creates new form Menuavaliacao2 */
    public Menuavaliacao2() {
        initComponents();
        ver.setEnabled(false);
        chckTabela();
    }
    
    public void chckTabela(){
        tabela.addMouseListener(new MouseAdapter() {

            public void mousePressed(MouseEvent me) {
                ver.setEnabled(true);
            }
        });
    }

    
    public void setVerEnable(boolean set){
        ver.setEnabled(set);
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLayeredPane1 = new javax.swing.JLayeredPane();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tabela = new javax.swing.JTable();
        ver = new javax.swing.JButton();

        setBackground(new java.awt.Color(255, 255, 255));

        jLayeredPane1.setBackground(new java.awt.Color(255, 255, 255));

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel2.setText("Avaliação");
        jLabel2.setBounds(0, 10, 180, 22);
        jLayeredPane1.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        tabela.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"Kim Kardashian", "79", "183cm", "1231", "213", "231", "231", "123", "21", "21", "23213"},
                {"Nuno Gomes", "80", "183cm", "1250", "240", "240", "244", "130", "25", "25", "23280"},
                {"Henrique Gomes", "81", "183cm", "1289", "258", "258", "266", "150", "32", "32", "23289"}
            },
            new String [] {
                "Nome", "Peso", "Altura", "BMI", "VO2máx", "FCRep", "FCMáx", "FCT1", "FCT2", "FCT3", "FCT4"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                true, false, false, false, false, false, false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tabela.setDragEnabled(true);
        tabela.getTableHeader().setReorderingAllowed(false);
        jScrollPane2.setViewportView(tabela);

        jScrollPane2.setBounds(0, 70, 750, 110);
        jLayeredPane1.add(jScrollPane2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        ver.setText("Ver");
        ver.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                verMouseClicked(evt);
            }
        });
        ver.setBounds(600, 240, 53, 25);
        jLayeredPane1.add(ver, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 762, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(26, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 409, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void verMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_verMouseClicked
        AvaliacaoEdit novo = new AvaliacaoEdit(null, true);
        
         int row = tabela.getSelectedRow();
        String nome = tabela.getValueAt(row, 0).toString();
        novo.setmyTitle(nome);
        
        novo.setLocation(100, 100);
        novo.setVisible(true);
    }//GEN-LAST:event_verMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable tabela;
    private javax.swing.JButton ver;
    // End of variables declaration//GEN-END:variables
}
